/****************************************************
          File Name:10-5_imply.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Tue 23 Dec 2014 03:46:15 PM CST
*****************************************************/

#include"10-5.h"

Stack::Stack()
{
    top = 0;
}

bool Stack::isempty() const
{
    return top == 0;
}

bool Stack::isfull() const
{
    return top == MAX;
}

bool Stack::push(const Item & item)
{
    if(top < MAX)
    {
        items[top++] = item;
        return true;
    }
    else
        return false;
}

bool Stack::pop(Item & item)
{
    if(top > 0)
    {
        item = items[--top];
        return true;
    }
    else
        return false;
}
